package oj;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        int[] data = new int[1000005];

        int t = Reader.nextInt();
        while ((t--) > 0) {
            int[] sum = new int[1000005];
            int n = Reader.nextInt();
            int m = Reader.nextInt();
            sum[0] = 0;
            for (int i = 1; i <= n; i++) {
                data[i] = Reader.nextInt();
                sum[i] = sum[i - 1] + data[i];
            }
            int max = sum[m];
            for (int i = 0; i <= n; i++) {
                int length = (sum[n] - sum[i]);
                if (max < length) {
                    max = length;
                }
            }
            System.out.println(max);
        }
    }

    private static int maxNumber(int a, int b) {
        if (a > b) {
            return a;
        }
        return b;
    }

    static class Reader {
        static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        static StringTokenizer tokenizer = new StringTokenizer("");

        static String nextLine() throws IOException {// 读取下一行字符串
            return reader.readLine();
        }

        static String next() throws IOException {// 读取下一个字符串
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {// 读取下一个int型数值
            return Integer.parseInt(next());
        }

        static double nextDouble() throws IOException {// 读取下一个double型数值
            return Double.parseDouble(next());
        }
    }


}